<?php
class Producto extends AppModel {
	
	public $name = 'Producto';
	
    public $hasAndBelongsToMany = array(
        'Rubro' =>
            array(
                'className'              => 'Rubro',
                'joinTable'              => 'rubros_productos',
                'foreignKey'             => 'producto_id',
                'associationForeignKey'  => 'rubro_id'
            ),			
        'Linea' =>
            array(
                'className'              => 'Linea',
                'joinTable'              => 'lineas_productos',
                'foreignKey'             => 'producto_id',
                'associationForeignKey'  => 'linea_id'
            )
    );
    
    
        public $belongsTo = array(
        'Marca' => array(
            'className'    => 'Marca',
            'foreignKey'   => 'm_id'
        )
    );
	
	public $validate = array (
        'nombre' => array('rule' => 'notEmpty'),
        'descripcion' => array('rule' => 'notEmpty'),
    );
}
